/*
 * channelserver.h
 *
 *  Created on: 2013. 7. 19.
 *      Author: jjaehuny
 */

#ifndef CHANNELSERVER_H_
#define CHANNELSERVER_H_

#include <Dispatcher/Static.h>
#include <Network/Network.h>

#include "../idl/iFriends.h"

#include <string>

namespace FriendsServer {

class ChannelServer : public Dispatcher::Session
{
public:
	ChannelServer();
	virtual ~ChannelServer();

public:
	template <class MSG> void SendMsg(const MSG& msg)
	{
		Dispatcher::ListenHandler<Session, Network::Packet>::SendMsg(this, msg);
	}


public:
	int		GetChannelKey() { return _channelKey; }

private:
	int 	_channelKey;
};

struct Msg
{
public:
	static const int s_MaxUser = 20000;
	static const int s_Mode = 10;

public:
	static void OnSocialMyInfo(Dispatcher::Session* pSession, ::Network::Packet * pPacket);
	static void OnMainListSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnReceiveSocialIDSendToUserSeq(Dispatcher::Session* pSession, ::Network::Packet * pPacket);
	static void OnInGameFriendsUserSeq(Dispatcher::Session* pSession, ::Network::Packet * pPacket);
	static void OnFriendsDetailInfoFromKakao(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnFriendsDetailInfoFromInGame(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnInviteNoAppSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnNewsCountSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnNewsInfoSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnSimpleFriendsSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnUpdateProfileSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnUpdateStatusSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnInviteBlockSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnFriendShipBlockSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnSendHeartSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnRecommendSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnBoastSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnUseBuffSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnInviteFriendInGameSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );


	static void OnConfirmFriendSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnRequestConnectSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnConfirmNewsSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnDeleteFriendSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnFriendTypeModifySyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnFlushUserInfo(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnRemoveUser(Dispatcher::Session* pSession, ::Network::Packet * pPacket );

	static void OnCheckEnableAllowSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );

	static void OnInviteCount(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnGachyaBoxSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnLastWeekRankInfoSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnGetHeartCountSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnAddHeartCountSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnFriendKillTimerSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );

	static void OnSendStaminaSyn(Dispatcher::Session* pSession, ::Network::Packet * pPacket );
	static void OnConfirmNewsV2Syn(Dispatcher::Session* pSession, ::Network::Packet * pPacket);

	static void OnUnregister(Dispatcher::Session* pSession, ::Network::Packet * pPacket);
};

struct init_state : public Dispatcher::Session::State
{
public:
	init_state()
	{
		AddCommand(SocialMyInfoSyn::MSG_ID, Msg::OnSocialMyInfo);
		AddCommand(MainListSyn::MSG_ID, Msg::OnMainListSyn);
		AddCommand(SocialUserSeqSyn::MSG_ID, Msg::OnReceiveSocialIDSendToUserSeq);
		AddCommand(GameUserSeqSyn::MSG_ID, Msg::OnInGameFriendsUserSeq);
		AddCommand(SocialFriendsSyn::MSG_ID, Msg::OnFriendsDetailInfoFromKakao);
		AddCommand(GameFriendsSyn::MSG_ID, Msg::OnFriendsDetailInfoFromInGame);
		AddCommand(InviteNoAppSyn::MSG_ID, Msg::OnInviteNoAppSyn);
		AddCommand(NewsCountSyn::MSG_ID, Msg::OnNewsCountSyn);
		AddCommand(NewsInfoSyn::MSG_ID, Msg::OnNewsInfoSyn);
		AddCommand(SimpleFriendsSyn::MSG_ID, Msg::OnSimpleFriendsSyn);
		AddCommand(UpdateProfileSyn::MSG_ID, Msg::OnUpdateProfileSyn);
		AddCommand(UpdateStatusSyn::MSG_ID, Msg::OnUpdateStatusSyn);
		AddCommand(InviteBlockSyn::MSG_ID, Msg::OnInviteBlockSyn);
		AddCommand(FriendShipBlockSyn::MSG_ID, Msg::OnFriendShipBlockSyn);
		AddCommand(SendHeartSyn::MSG_ID, Msg::OnSendHeartSyn);
		AddCommand(RecommendSyn::MSG_ID, Msg::OnRecommendSyn);
		AddCommand(BoastSyn::MSG_ID, Msg::OnBoastSyn);
		AddCommand(UseBuffSyn::MSG_ID, Msg::OnUseBuffSyn);
		AddCommand(GameFriendSyn::MSG_ID, Msg::OnInviteFriendInGameSyn);
		AddCommand(ConfirmFriendSyn::MSG_ID, Msg::OnConfirmFriendSyn);
		AddCommand(RequestConnectSyn::MSG_ID, Msg::OnRequestConnectSyn);
		AddCommand(ConfirmNewsSyn::MSG_ID, Msg::OnConfirmNewsSyn);
		AddCommand(DeleteFriendSyn::MSG_ID, Msg::OnDeleteFriendSyn);
		AddCommand(FriendTypeModifySyn::MSG_ID, Msg::OnFriendTypeModifySyn);
		AddCommand(FlushFRUserInfoSyn::MSG_ID, Msg::OnFlushUserInfo);
		AddCommand(RemoveFRUserSyn::MSG_ID, Msg::OnRemoveUser);
		AddCommand(AllowFriendSyn::MSG_ID, Msg::OnCheckEnableAllowSyn);
		AddCommand(InviteCountSyn::MSG_ID, Msg::OnInviteCount);
		AddCommand(GachyaBoxSyn::MSG_ID, Msg::OnGachyaBoxSyn);
		AddCommand(LastWeekRankInfoSyn::MSG_ID, Msg::OnLastWeekRankInfoSyn);
		AddCommand(GetHeartCountSyn::MSG_ID, Msg::OnGetHeartCountSyn);
		AddCommand(AddHeartCountSyn::MSG_ID, Msg::OnAddHeartCountSyn);
		AddCommand(FriendKillTimerSyn::MSG_ID, Msg::OnFriendKillTimerSyn);
		AddCommand(SendStaminaSyn::MSG_ID, Msg::OnSendStaminaSyn);
		AddCommand(ConfirmNewsV2Syn::MSG_ID, Msg::OnConfirmNewsV2Syn);
		AddCommand(UnregisterSyn::MSG_ID, Msg::OnUnregister);
	}
};

} /* namespace FriendsServer */
#endif /* CHANNELSERVER_H_ */
